/*
 * Copyright (c) 2023 Huawei Technologies Co., Ltd.
 * openUBMC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *         http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

#ifndef ACCESSOR_H
#define ACCESSOR_H

#include "interface/i_accessor.h"
#include <mc/engine.h>

namespace dev {

class Accessor : public mc::engine::object<Accessor> {
public:
    MC_OBJECT(Accessor, "Accessor", "/bmc/dev/Accessor/${object_name}", (IAccessor))

    Accessor()  = default;
    ~Accessor() = default;
    bool        init(mc::mutable_dict& csr_object, const mc::dict& connector);
    std::string dump();

    IAccessor i_accessor;

    // 自定义序列化/反序列化，用于扁平结构CSR映射
    static void from_variant(const mc::dict& d, Accessor& obj);
};

} // namespace dev

#endif // ACCESSOR_H